<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>老师录入学生成绩</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link rel="stylesheet" type="text/css" href="css/student.css">
<SCRIPT LANGUAGE="JavaScript">

function check(){
 var temp=/^\d+(\.\d+)?$/;
 var s = document.getElementById("test");
if(temp.test(s.value)==false)
 alert("请输入非负数字");
}

</SCRIPT>
</head>

<body>
	<jsp:include page="head.jsp"></jsp:include>
	<div>
		<div id="left">
			<ul>

				<li>
					<h2>
						<a href="<%=basePath%>show_score.jsp">录入学生成绩</a>
					</h2>
				</li>
				<li>
					<h2>
						<a href="<%=basePath%>showallscore.jsp">查看学生成绩</a>
					</h2>
				</li>
			</ul>
		</div>
		<div id="main">
			<h4>当前位置 ****** 插入成绩查询</h4>
			<!-- 老师根据年级，专业，班级查询所教的未录入成绩学生信息并且插入学生成绩 -->
			<form action="showScores.action" method="post">
				<input type="hidden" name="id" value="<s:property value="#session['u']" />" /> <font color="#1a1afa">所教课程</font> <select name="course">

					<option value="软件工程">软件工程</option>
					<option value="数据结构">数据结构</option>
					<option value="杂草识别">杂草识别</option>
				</select>&nbsp;&nbsp; <font color="#1a1afa">年级</font> <select name="grade">
					<option value="any">-不限-</option>
					<option value="11">11级</option>
					<option value="12">12级</option>
				</select>&nbsp;&nbsp; <font color="#1a1afa">专业</font> <select name="major">
                    <option value="信息管理与信息系统">信息管理与信息系统</option>
					<option value="软件工程">软件工程</option>
				</select>&nbsp;&nbsp; <font color="#1a1afa">所在班级</font> <select name="theclass">
					<option value="any">-不限-</option>
					<option value="1">1</option>
					<option value="2">2</option>
				</select>&nbsp;&nbsp; <font color="#1a1afa">学年</font> <select name="academic_year">
					<option value="any">-不限-</option>
					<option value="2010-2011">2010-2011</option>
					<option value="2011-2012">2011-2012</option>
					<option value="2012-2013">2012-2013</option>
					<option value="2013-2014">2013-2014</option>
					<option value="2014-2015">2014-2015</option>
				</select>&nbsp;&nbsp; <font color="#1a1afa">学期</font> <select name="term">
					<option value="any">-不限-</option>
					<option value="1">1</option>
					<option value="2">2</option>
				</select>&nbsp;&nbsp;</br> </br> <input type="submit" value="查  询 " class="button" /> &nbsp;&nbsp; </form>

			<s:if test="#request['s']!=null">
				<!-- 如果查询成功信息用table在如下显示 -->
				<s:form action="updateScores.action" method="post">
					<table border="1" class="gridtable">
						<tr>
							<td>学年</td>
							<td>学期</td>
							<td>学生学号</td>
							<td>学生姓名</td>
							<td>专业</td>
							<td>年级</td>
							<td>班级</td>
							<td>课程代码</td>
							<td>课程名称</td>
							<td>平时成绩</td>
							<td>期末成绩</td>
							<td>总成绩</td>

						</tr>

						<s:iterator value="#request['s']" id="score" status="stat">

							<tr>

								<s:hidden name="scores[%{#stat.index}].id" value="%{#score.id}" cssStyle="width:80px" />
								<td><s:property value="#score.academicYear" />
								</td>
								<td><s:property value="#score.term" />
								</td>
								<td><s:property value="#score.student.id" />
								</td>
								<td><s:property value="#score.student.name" />
								</td>
								<td><s:property value="#score.student.major" />
								</td>
								<td><s:property value="#score.student.grade" />
								</td>
								<td><s:property value="#score.student.theclass" />
								</td>
								
								<td><s:property value="#score.course.CId" />
								</td>
								<td><s:property value="#score.course.CName" />
								</td>
								<td><s:textfield name="scores[%{#stat.index}].gradeU" value="%{#score.gradeU}" style="width:40px" id="test" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" /></td>
								<td><s:textfield name="scores[%{#stat.index}].gradeF" value="%{#score.gradeF}" cssStyle="width:40px" id="test" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" /></td>
								<td><s:textfield name="scores[%{#stat.index}].grade" value="%{#score.grade}" cssStyle="width:40px" id="test" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" /></td>
								
								</td>
							</tr>
						</s:iterator>
					</table>
					</br>
					<s:submit value="提交修改" />
					<!-- 插入学生成绩 -->
				</s:form>

			</s:if>
			<s:property value="#request.meg" />
			<!-- 返回是否成功的信息 -->
		</div>

	</div>

	<span id="result"></span>
	<hr width=100% size=5 color=#2323fe style="FILTER: alpha(opacity=100,finishopacity=0,style=3)">



</body>
</html>
